<?php


namespace EasySwoole\EasySwoole;


use App\Event\Initialize;
use App\Event\MainServerCreate;
use EasySwoole\Actor\Exception\InvalidActor;
use EasySwoole\EasySwoole\AbstractInterface\Event;
use EasySwoole\EasySwoole\Swoole\EventRegister;
use EasySwoole\RedisPool\Exception\Exception;
use EasySwoole\RedisPool\RedisPoolException;

class EasySwooleEvent implements Event
{
    public static function initialize()
    {
        date_default_timezone_set('Asia/Shanghai');

        Initialize::getInstance()->initialize();
    }

    /**
     * @throws Exception
     * @throws \EasySwoole\Pool\Exception\Exception
     * @throws \EasySwoole\Socket\Exception\Exception
     * @throws RedisPoolException|InvalidActor
     */
    public static function mainServerCreate(EventRegister $register)
    {
        MainServerCreate::getInstance()->initialize($register);
    }
}